<?php

namespace common\models\workin_tables;

use Yii;

/**
 * This is the model class for table "{{%car_invonce_verify_huirong_back}}".
 *
 * @property integer $id
 * @property integer $car_invonce_verify_huirong_id
 * @property string $report_id
 * @property integer $pic_type
 * @property string $order_report_id
 * @property integer $status
 * @property string $query_result
 *
 * @property CarInvonceVerifyHuirong $carInvonceVerifyHuirong
 */
class CarInvonceVerifyHuirongBack extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%car_invonce_verify_huirong_back}}';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('db_workin');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['car_invonce_verify_huirong_id', 'report_id', 'pic_type'], 'required'],
            [['car_invonce_verify_huirong_id', 'pic_type', 'status'], 'integer'],
            [['query_result'], 'string'],
            [['report_id', 'order_report_id'], 'string', 'max' => 200],
            [['car_invonce_verify_huirong_id'], 'unique'],
            [['car_invonce_verify_huirong_id'], 'exist', 'skipOnError' => true, 'targetClass' => CarInvonceVerifyHuirong::className(), 'targetAttribute' => ['car_invonce_verify_huirong_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'car_invonce_verify_huirong_id' => Yii::t('app', 'Car Invonce Verify Huirong ID'),
            'report_id' => Yii::t('app', 'Report ID'),
            'pic_type' => Yii::t('app', 'Pic Type'),
            'order_report_id' => Yii::t('app', 'Order Report ID'),
            'status' => Yii::t('app', 'Status'),
            'query_result' => Yii::t('app', 'Query Result'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getCarInvonceVerifyHuirong()
    {
        return $this->hasOne(CarInvonceVerifyHuirong::className(), ['id' => 'car_invonce_verify_huirong_id']);
    }
}
